﻿using System;
using System.Collections.Generic;
using System.Text;
using ContentRenderingApi.Extender;
using ContentRenderingApi.Path;

namespace ContentRenderingApiSystemTest.Helper
{
    internal class CaptureRenderHelper 
    {
        private StringBuilder _voidFunctionStringBuilder = new StringBuilder();

        internal void ObserverFunctionCallback(NodeExtender nodeExtender)
        {
            if (!typeof(string).IsInstanceOfType(nodeExtender.RawValue))
            {
                return;
            }

            string stringValue = (string)nodeExtender.RawValue;

            this._voidFunctionStringBuilder.Insert(0, stringValue);
        }

        internal string FormattedOutputCallback(NodeExtender nodeExtender)
        {
            return this._voidFunctionStringBuilder.ToString();
        }
    }
}
